package gx.model;

import java.io.InputStream;
import java.util.Properties;

public class DbProperties {

	    private String className;   
	  
		private String url;   
	   
	    private String username;   
	  
	    private String password;   
	   
	    private String filePath;   
	

	    public String getProperty(String property){
	    	InputStream input;
	    	Properties properties = new Properties();
	    	try {
//				input = Class.forName("gx.test.model.DbProperties").getResourceAsStream(getFilePath());
	    		input = Class.forName(DbProperties.class.getName()).getResourceAsStream(this.getFilePath());
//	    		input = DbProperties.class.getClassLoader().getResourceAsStream("DB.properties");
	    		properties.load(input);
			} catch (Exception e) {
				e.printStackTrace();
			}
			return properties.getProperty(property);
	    }
	    
	    public String getClassName() {
			return getProperty("className");
		}

		public void setClassName(String className) {
			this.className = className;
		}

		public String getUrl() {
			return getProperty("url");
		}

		public void setUrl(String url) {
			this.url = url;
		}

		public String getUsername() {
			return getProperty("username");
		}

		public void setUsername(String username) {
			this.username = username;
		}

		public String getPassword() {
			return getProperty("password");
		}

		public void setPassword(String password) {
			this.password = password;
		}

		public String getFilePath() {
			return filePath;
		}

		public void setFilePath(String filePath) {
			this.filePath = filePath;
		}

}
